import 'package:flutter_deer/generated/json/base/json_convert_content.dart';
import 'package:flutter_deer/database/beans/get_all_goods_list.dart';
import 'package:flutter_deer/database/database_manager.dart';

import 'package:flutter_deer/dl/dl.dart';

import 'package:get/get.dart';


GetAllGoodsList $GetAllGoodsListFromJson(Map<String, dynamic> json) {
  final GetAllGoodsList getAllGoodsList = GetAllGoodsList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    getAllGoodsList.id = id;
  }
  final String? goodsName = jsonConvert.convert<String>(json['goodsName']);
  if (goodsName != null) {
    getAllGoodsList.goodsName = goodsName;
  }
  final String? unitName = jsonConvert.convert<String>(json['unitName']);
  if (unitName != null) {
    getAllGoodsList.unitName = unitName;
  }
  final String? quantity = jsonConvert.convert<String>(json['quantity']);
  if (quantity != null) {
    getAllGoodsList.quantity = quantity;
  }
  final double? price = jsonConvert.convert<double>(json['price']);
  if (price != null) {
    getAllGoodsList.price = price;
  }
  final int? goodAmount = jsonConvert.convert<int>(json['goodAmount']);
  if (goodAmount != null) {
    getAllGoodsList.goodAmount = goodAmount;
  }
  final int? virtual = jsonConvert.convert<int>(json['virtual']);
  if (virtual != null) {
    getAllGoodsList.virtual = virtual;
  }
  final String? coverImageUrl = jsonConvert.convert<String>(json['coverImageUrl']);
  if (coverImageUrl != null) {
    getAllGoodsList.coverImageUrl = coverImageUrl;
  }
  final String? goodsBarCode = jsonConvert.convert<String>(json['goodsBarCode']);
  if (goodsBarCode != null) {
    getAllGoodsList.goodsBarCode = goodsBarCode;
  }
  final String? goodsCategoryName = jsonConvert.convert<String>(json['goodsCategoryName']);
  if (goodsCategoryName != null) {
    getAllGoodsList.goodsCategoryName = goodsCategoryName;
  }
  final String? goodsCategoryId = jsonConvert.convert<String>(json['goodsCategoryId']);
  if (goodsCategoryId != null) {
    getAllGoodsList.goodsCategoryId = goodsCategoryId;
  }
  final String? goodsId = jsonConvert.convert<String>(json['goodsId']);
  if (goodsId != null) {
    getAllGoodsList.goodsId = goodsId;
  }
  final String? salesChannelGoodsId = jsonConvert.convert<String>(json['salesChannelGoodsId']);
  if (salesChannelGoodsId != null) {
    getAllGoodsList.salesChannelGoodsId = salesChannelGoodsId;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    getAllGoodsList.status = status;
  }
  final String? statusName = jsonConvert.convert<String>(json['statusName']);
  if (statusName != null) {
    getAllGoodsList.statusName = statusName;
  }
  final String? residueStock = jsonConvert.convert<String>(json['residueStock']);
  if (residueStock != null) {
    getAllGoodsList.residueStock = residueStock;
  }
  final String? freezeStock = jsonConvert.convert<String>(json['freezeStock']);
  if (freezeStock != null) {
    getAllGoodsList.freezeStock = freezeStock;
  }
  return getAllGoodsList;
}

Map<String, dynamic> $GetAllGoodsListToJson(GetAllGoodsList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['goodsName'] = entity.goodsName;
  data['unitName'] = entity.unitName;
  data['quantity'] = entity.quantity;
  data['price'] = entity.price;
  data['goodAmount'] = entity.goodAmount;
  data['virtual'] = entity.virtual;
  data['coverImageUrl'] = entity.coverImageUrl;
  data['goodsBarCode'] = entity.goodsBarCode;
  data['goodsCategoryName'] = entity.goodsCategoryName;
  data['goodsCategoryId'] = entity.goodsCategoryId;
  data['goodsId'] = entity.goodsId;
  data['salesChannelGoodsId'] = entity.salesChannelGoodsId;
  data['status'] = entity.status;
  data['statusName'] = entity.statusName;
  data['residueStock'] = entity.residueStock;
  data['freezeStock'] = entity.freezeStock;
  return data;
}

extension GetAllGoodsListExtension on GetAllGoodsList {
  GetAllGoodsList copyWith({
    int? id,
    String? goodsName,
    String? unitName,
    String? quantity,
    double? price,
    int? goodAmount,
    int? virtual,
    String? coverImageUrl,
    String? goodsBarCode,
    String? goodsCategoryName,
    String? goodsCategoryId,
    String? goodsId,
    String? salesChannelGoodsId,
    String? status,
    String? statusName,
    String? residueStock,
    String? freezeStock,
    Rx<int>? count,
  }) {
    return GetAllGoodsList()
      ..id = id ?? this.id
      ..goodsName = goodsName ?? this.goodsName
      ..unitName = unitName ?? this.unitName
      ..quantity = quantity ?? this.quantity
      ..price = price ?? this.price
      ..goodAmount = goodAmount ?? this.goodAmount
      ..virtual = virtual ?? this.virtual
      ..coverImageUrl = coverImageUrl ?? this.coverImageUrl
      ..goodsBarCode = goodsBarCode ?? this.goodsBarCode
      ..goodsCategoryName = goodsCategoryName ?? this.goodsCategoryName
      ..goodsCategoryId = goodsCategoryId ?? this.goodsCategoryId
      ..goodsId = goodsId ?? this.goodsId
      ..salesChannelGoodsId = salesChannelGoodsId ?? this.salesChannelGoodsId
      ..status = status ?? this.status
      ..statusName = statusName ?? this.statusName
      ..residueStock = residueStock ?? this.residueStock
      ..freezeStock = freezeStock ?? this.freezeStock
      ..count = count ?? this.count;
  }
}